|
|
|
|
|
|
|
res = GetVolumeInformation(Left$(Drive1.Drive, 2) & "\",
VolumeName, 255, SerialNumber, ComponentLength,
FileSystemFlags, FileSystem, 255)
If res = 0 Then
MsgBox "GetVolumeInformation Error: " & _
GetErrorString(Err.LastDllError)
Exit Sub
End If
List1.Clear
List1.AddItem "Drive " & Drivel.Drive
List1.AddItem "Name: " & VolumeName
List1.AddItem "Component Length: " & ComponentLength
List1.AddItem "Serial #: " & Hex$((SerialNumber \ &H10000) And &HFFFF&) _
& "-" & Hex$(SerialNumber And &HFFFF&)
List1.AddItem "FileSystem: " & FileSystem
End Sub
Private Sub Drive1_Change()
LoadVolumeInfo
End Sub
Private Sub Form_Load()
LoadVolumeInfo
End Sub |
|
|
|
|
|
|
|
|
You may have noticed that the program does not bother to strip off the part of the string after the NULL termination character after the GetVolumeInformation function loads data into the FileSystem and VolumeName variables. This program can get away with this because the information is loaded directly into a list box. The list box is based on the Windows LISTBOX control. This control expects to receive NULL-terminated strings, so even though you are passing a longer string to the control using the AddItem method, the control sees only the portion of the string up to the NULL termination character. |
|
|
|
|
|